<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>master节点日志查看</title>
    <script src="static/js/jquery.min.js"></script>
    <script src="static/js/jquery.form.min.js"></script>
    <style type="text/css">
        .bodyCss {
            font-size: 15px;
            width: 1024px;
        }

        .tableCss {
            font-size: 15px;
            width: 100%;
            padding-left: 5px;
            margin: auto;
        }
    </style>
</head>
<body class="bodyCss">
<div>
    <h2>云端master节点日志查询服务</h2>
</div>

<div>
    <div>文件名：<input title="根据文件名模糊查询,请输入文件名" placeholder="请输入文件名"  width="600" id="selectCondition"/>
        <button id="select" onclick="selectFiles()">查询</button>
        <!-- <div style="float: right;width:130px;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="/zuul/zuul-config.html">动态路由配置</a></div>
        <div style="float: right;width:150px;"><a href="javascript:void(0);" onclick="initDictionaryData();">初始化数据字典服务</a></div>
        <div style="float: right;width:130px;"><a href="/comm-schedule-server/task/index.html">配置定时任务</a></div>
        <div style="float: right;width:130px;"><a href="/comm-work-flow-server/workflow/workflowinfo/flow-manage.html">配置工作流</a></div> -->
    </div>
    <!--    <table width="748" border="1" cellpadding="4" cellspacing="4" bordercolor="#999999" align="left" bordercolor="#006633" id="fileListID">-->
    <table class="tableCss" border="1" cellpadding="4" cellspacing="4" bordercolor="#999999" align="left"
           bordercolor="#006633" id="fileListID">
    </table>
</div>
<script>
    $(function () {
    	selectFiles();
    })
    
    function initDictionaryData() {
        $.ajax({
            url: '/comm-dictionary-server/dictionary/initDictionaryData',
            type: 'get',
            processData: false,
            contentType: false,
            success: function (res) {
                if (res.success) {
                	alert('初始化数据完成！【' + res.data + "】");
                } else {
                    alert('初始化数据失败');
                }
            }
        })
    }

    function selectFiles() {
        var selectCondition = $('#selectCondition').val();
        $.ajax({
            url: '/zuul/scpfile/findFileList?fileName=' + selectCondition,
            type: 'get',
            processData: false,
            contentType: false,
            success: function (res) {
                if (res.success) {
                    jsonData = res.data;
                    var listInit = '<tr>\n' +
                        '      <th scope="col">文件名</th>\n' +
                        '      <th>文件大小</th>\n' +
                        '      <th>操作</th>\n' +
                        '    </tr>';
                    $('#fileListID').html(listInit);
                    var content = '';
                    for (var i = 0; i < jsonData.length; i++) {
                        content += '<tr>\n' +
                            '      <td align="left" scope="row">' + jsonData[i].fileName + '</td>\n' +
                            '      <td>' + jsonData[i].fileSize + '</td>\n' +
                            '      <td align="center"><a href=\'/zuul/scpfile/downloadFile?fileName=' + jsonData[i].fileName + '\'>' + '下载' + '</a>' +
                            '      </td>\n' +
                            '    </tr>';

                    }
                    $('#fileListID').append(content);
                } else {
                    alert('失败');
                }
            }
        })
    }
</script>
</body>

</html>